﻿CREATE FUNCTION [dbo].[MinDate] (@a datetime,@b datetime)  
RETURNS datetime WITH SCHEMABINDING AS  
BEGIN 
RETURN(
SELECT MIN(v) FROM(SELECT @a v UNION SELECT @b)T
)
END


